//
//  Node.cpp
//  Simulation
//
//  Created by Christopher Kemsley on 3/3/12.
//  Copyright (c) 2012 iAppolopolis. All rights reserved.
//

#include "Model.hpp"



std::ostream&	operator<<	( std::ostream& stream , ModelVariant const & variant )
	{
	stream << "<" ;
	stream << variant.builderName ;
	stream << " (\"" << variant.instanceName << "\") @ " ;
	stream << variant.configURL << ">" ;
	return stream ;
	}

std::ostream&	operator<<	( std::ostream & stream , Model* model )
	{
	stream << (model->identity) ;
	return stream ;
	}









ModelVariant :: ModelVariant ( )
:	builderName()
,	instanceName()
,	configURL()
	{
	
	}
ModelVariant :: ModelVariant ( ModelVariant const & copy )
:	builderName(copy.builderName)
,	instanceName(copy.instanceName)
,	configURL(copy.configURL)
	{
	
	}
ModelVariant :: ~ModelVariant ()
	{
	
	}
bool			ModelVariant :: isComplete ()
	{
	if ( builderName.size() == 0 )
		return false ;
	if ( instanceName.size() == 0 )
		return false ;
	if ( configURL.path().size() == 0 )
		return false ;
	return true ;
	}

ModelVariant&	ModelVariant :: operator=	( ModelVariant const & copy )
	{
	builderName=copy.builderName;
	instanceName=copy.instanceName;
	configURL=copy.configURL;
	return *this ;
	}



Model :: Model	( ModelVariant const & inIdentity )
:	sc_module	( inIdentity.moduleName() )
,	identity	( inIdentity )
	{
	
	}



sc_module_name const&	ModelVariant :: moduleName () const
	{
	ThrowException ( "ModelVariant" , "Models can only be created by the factory" , __FILE__ , __LINE__ ) ;
	// Never called, but no-return avoids warnings:
	static sc_module_name m ("") ;
	return m ;
	}
sc_module_name const&	ConstructionVariant :: moduleName () const
	{
	return mName ;
	}

